from rest_framework.views import APIView, View  # api视图接口
from rest_framework import serializers  # 序列化器
from rest_framework.response import Response
from django.http.response import JsonResponse  # drf的回应
from rest_framework.viewsets import ModelViewSet
from bookshop.models import UserHistory, UserCollection, UserType, UserBlack, UserBook
from bookshop import sers
from .filters import UserFilter


class UserTypeModelViewSet(ModelViewSet):
    """用户类型"""
    queryset = UserType.objects.all()
    serializer_class = sers.TypesUserSerializer


class UserCollectModelViewSet(ModelViewSet):
    """用户收藏表"""
    queryset = UserCollection.objects.all()
    serializer_class = sers.UserCollectionModelSerializer


class UserBlackModelViewSet(ModelViewSet):
    """用户状态"""
    queryset = UserBlack.objects.all()
    serializer_class = sers.UserBlackSerializer


class UserBookModelViewSet(ModelViewSet):
    """用户书架表"""
    queryset = UserBook.objects.all()
    serializer_class = sers.UserBookModelSerializer


class UserHistoryModelViewSet(ModelViewSet):
    """用户书架表"""
    queryset = UserHistory.objects.all()
    serializer_class = sers.UserHistoryModelSerializer